function [bits, Hc, Wc] = image2bits(image)

[Hc, Wc, ~] = size(image);

% RGB -> bits
pixelsRGB = reshape(image, [], 3);
bitsR = de2bi(pixelsRGB(:, 1), 8, "left-msb");
bitsG = de2bi(pixelsRGB(:, 2), 8, "left-msb");
bitsB = de2bi(pixelsRGB(:, 3), 8, "left-msb");

bitsRGBperPixel = [bitsR, bitsG, bitsB];
bits = reshape(bitsRGBperPixel.', [], 1);

end
